<template>
  <div>
    <el-button type="text" @click="dialogFormVisible = true"
      >新增销售员</el-button
    >
    <!-- <el-dialog title="新增销售员" :visible.sync="dialogFormVisible" width="10">
      <el-form :model="form">
        <el-form-item label="姓名" :label-width="formLabelWidth" :widtn="40">
          <el-input
            v-model="form.name"
            autocomplete="off"
            size="mini"
          ></el-input>
        </el-form-item>
        <el-form-item label="账号" :label-width="formLabelWidth">
          <el-input v-model="form.age" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="密码" :label-width="formLabelWidth">
          <el-input v-model="form.add" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false"
          >确 定</el-button
        >
      </div>
    </el-dialog> -->
    <el-table style="width: 100%" :data="salesmansDate" border :stripe="true">
      <el-table-column prop="_id" label="销售员编号" width="200">
      </el-table-column>
      <el-table-column prop="name" label="销售员姓名" width="180">
      </el-table-column>
      <el-table-column prop="account" label="销售员账号" width="180">
      </el-table-column>
      <el-table-column prop="password" label="销售员密码" width="180">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            @click="$router.push('/adminsSystem/salesmansAmend')"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="danger"
            @click="deleteSalesmans(scope.row._id)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

 <script>
import { createNamespacedHelpers } from "vuex";
const { mapState, mapActions } = createNamespacedHelpers("salesmans");
export default {
  data() {
    return {
      dialogTableVisible: false,
      dialogFormVisible: false,
      // salesmansData: {
      //   salesmans: [],
      // },
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },
      formLabelWidth: "80px",
    };
  },
  created() {
    this.getSalesmans();
  },
  methods: {
    ...mapActions(["getSalesmans", "deleteSalesmans"]),
    // tiaoz() {
    //   this.$router.push("/adminsSystem/salesmansAmend");
    // },
  },
  computed: {
    ...mapState(["salesmansDate"]),
  },
};
</script>

